package BookManage.qb;

import BookManage.Servlet.BookManageServlet;
import BookManage.Servlet.Impl.BookManageImplServlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/dd")
public class ddServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int count=0;
        PrintWriter out=response.getWriter();
        String id=request.getParameter("id");
        BookManageServlet manageServlet=new BookManageImplServlet();
        count=manageServlet.sc(id);
        if(count>0){
            out.println("<script type=\"text/javascript\">\n" +
                    "    alert(\"删除成功\");\n" +
                    "    location.href=\"/untitled1_war_exploded/cx?BookNo=1\";\n" +
                    "</script>");
        }else{
            out.println("<script type=\"text/javascript\">\n" +
                    "    alert(\"删除失败\");\n" +
                    "    location.href=\"/untitled1_war_exploded/cx?BookNo=1\";\n" +
                    "</script>");
        }
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
